package biz.datalk.industrialland.admin.modules.system.pojo.dto;

import biz.datalk.industrialland.common.pojo.po.BasePO;
import biz.datalk.industrialland.common.validated.*;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * @author tarofang@163.com
 * @date 2019-12-23
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class SysDictItemDTO extends BasePO implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * sys_dict_item.id
     */
    @EqualsAndHashCode.Include
    @NotNull(groups = {Update.class, Delete.class}, message = "{sysdictitem.no.exists.or.delete}")
    private Long id;

    /**
     * 字典id，sys_dict.id
     * <p>
     * sys_dict_item.dict_id
     */
    @NotBlank(groups = {CusList.class, Insert.class, Update.class}, message = "{sysdictitem.blank.dictId}")
    private String dictId;

    /**
     * 字典项文本
     * <p>
     * sys_dict_item.item_text
     */
    @NotBlank(groups = {Update.class, Insert.class}, message = "{sysdictitem.invalid.itemText}")
    private String itemText;

    /**
     * 字典项值
     * <p>
     * sys_dict_item.item_value
     */
    @NotBlank(groups = {Update.class, Insert.class}, message = "{sysdictitem.invalid.itemValue}")
    private String itemValue;

    /**
     * 描述
     * <p>
     * sys_dict_item.description
     */
    private String description;

    /**
     * 排序
     * <p>
     * sys_dict_item.item_order
     */
    // @Pattern(regexp = "^[1-9]\\d*$", groups = {Update.class, Insert.class}, message = "{sysdictitem.invalid.itemOrder}")
    @NotNull(groups = {Update.class, Insert.class}, message = "{sysdictitem.invalid.itemOrder}")
    private Integer itemOrder;

    /**
     * 是否有效 Y-有效 N-无效
     * <p>
     * sys_dict_item.is_valid
     */
    @Pattern(regexp = "^[Y|N]$", groups = {Update.class, Insert.class}, message = "{sysdictitem.invalid.isValid}")
    @NotBlank(groups = {Update.class, Insert.class}, message = "{sysdictitem.invalid.isValid}")
    private String isValid;

    /**
     * 是否删除 Y-已删除 N-未删除
     * <p>
     * sys_dict_item.is_delete
     */
    private String isDelete;

    @NotBlank(groups = BatchDelete.class, message = "{sysdictitem.no.exists.or.delete}")
    private String sysids;
}
